﻿using UnityEngine;
using System.Collections;

public class Lemming : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
			this.rigidbody2D.AddForce(new Vector2(2.5f,0));
	}

	void OnCollisionEnter2D(Collision2D coll) {
		Debug.Log ("COM "+coll.gameObject.name);
		if(coll.gameObject.name == "Door") {
			GameObject.Destroy (this.gameObject);
			Hud.instance.homed += 1;
			if(Hud.instance.homed==Hud.instance.lemmingsCount){
				Hud.instance.Advance();
			}
		}
	}
}
